package com.hamster.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hamster.crm.pojo.dto.RoleAndPermission;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Tarry
 * @create 2020/1/2 13:37
 */
@Repository
@Mapper
public interface RoleAndPermissionMapper extends BaseMapper<RoleAndPermission> {

    /**
     * 删除该角色的所有权限
     * @param roleId
     */
    @Delete("delete from tb_role_permission where role_id = #{roleId}")
    void deleteByRoleId(@Param("roleId") String roleId);

    @Select("select permission_id from tb_role_permission where role_id=#{roleId}")
    List<String> getPermissionByRoleId(@Param("roleId") String roleId);
}
